const Sequelize = require('sequelize');
const DB = require("../config/dbconfig");

const commentLikeModel = DB.define('comment_like_tab', {
    comment_like_id: {
      type: Sequelize.INTEGER,
      allowNull: false,
      primaryKey: true,
      comment: "评论点赞表id，外键"
    },
    comment_id: {
      type: Sequelize.INTEGER,
      allowNull: true,
      comment: "评论表外键",
      references: {
        model: 'comment_tab',
        key: 'comment_id'
      }
    },
    user_id: {
      type: Sequelize.INTEGER,
      allowNull: true,
      comment: "用户表外键",
      references: {
        model: 'user_tab',
        key: 'user_id'
      }
    },
    comment_like_time:{
      type:Sequelize.DATE,
      allowNull:true,
      comment:"评论点赞时间"
    },
    is_delete:{
      type:Sequelize.INTEGER(2),
      comment:"是否删除"
    }
  }, {
    Sequelize,
    tableName: 'comment_like_tab',
    timestamps: false,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "comment_like_id" },
        ]
      },
      {
        name: "like_comment",
        using: "BTREE",
        fields: [
          { name: "comment_id" },
        ]
      },
      {
        name: "like_user",
        using: "BTREE",
        fields: [
          { name: "user_id" },
        ]
      },
    ]
  });
module.exports = commentLikeModel
